-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pallet connectors gateway #1376
Conversation
pallets/connectors-gateway/connectors-gateway-routers/src/axelar_evm.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of comments about mocking, but looks quite good!
#[derive(Debug, Eq, PartialEq)] | ||
pub enum MessageMock { | ||
First, | ||
Second, | ||
} | ||
|
||
impl MessageMock { | ||
fn call_type(&self) -> u8 { | ||
match self { | ||
MessageMock::First => 0, | ||
MessageMock::Second => 1, | ||
} | ||
} | ||
} | ||
|
||
impl Codec for MessageMock { | ||
fn serialize(&self) -> Vec<u8> { | ||
vec![self.call_type()] | ||
} | ||
|
||
fn deserialize<I: Input>(input: &mut I) -> Result<Self, Error> { | ||
let call_type = input.read_byte()?; | ||
|
||
match call_type { | ||
0 => Ok(MessageMock::First), | ||
1 => Ok(MessageMock::Second), | ||
_ => Err("unsupported message".into()), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm going too far, but maybe a simple number can be used as a message to avoid this type?
An later use something like:
domain_router.send(sender, 42).unwrap()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That simple type wouldn't implement the Codec
trait, some boilerplate might still be needed regardless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm... that's weird 🤔 . I'm pretty sure Codec
and Serialize
is implemented for basic types. Could it be because the compiler doesn't know exactly what that 42
is? Sometimes in these cases, you need to help the compiler with something like 42u32
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are probably referring to a different Codec
trait, I'm referring to the one that we have in connectors - https://github.com/centrifuge/centrifuge-chain/blob/add-pallet-connectors-gateway/libs/traits/src/connectors.rs#L19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, you're right! Never mind then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although... would it make sense to add the basic types to the Codec
trait along with the implementation (as it happens with the substrate Codec
and Serialize
traits)? @NunoAlexandre @wischli
5a61d40
to
645b3a4
Compare
29ff74c
to
f95c168
Compare
pallets/connectors-gateway/connectors-gateway-routers/src/ethereum_xcm.rs
Show resolved
Hide resolved
Coming back to this: #1403 (comment) I think we will just benchmark the call as we usually do. IIUC this will result in the caller having to pay fees twice. For now I think it is fine, we must just create a todo to fix this! The only thing we must ensure is that these lines // Use the same conversion as the one used in `EnsureAddressTruncated`.
let sender_evm_address = H160::from_slice(&sender.as_ref()[0..20]); create the backwards conversion to the mapping that cc @branan for consolidation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion 👀
2452e2f
to
241d0e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Failing tests can be fixed by applying the latest changes of the precompile branch here. I just do not wnat the node changes in this PR. THe latest precompile stuff can already be included. |
* gateway: Move domain routers to runtime * gateway-routers: Move to separate crate * runtime: Remove unused deps * traits: Add more comments to Router trait, rename forward to send * connectors-gateway: Rename routers crate, use ensure! for validation * connectors: Rename submit to handle * connectors-gateway: Drop max message const, use Vec instead * connectors-gateway: Rename router and queues methods * connectors-gateway: Update edition to 2021 * gateway-routers: Drop wildcard import * connectors-gateway: Rename DomainSubmitters to ConnectorsAllowlist and associated types * connectors-gateway: Add missing features * connectors-gateway: Update deps and runtime config
* pallets: Add Ethereum Transaction pallet * ethereum-transaction: Drop origin * ethereum-transaction: Drop weights and origin type * ethereum-transaction: Handle call info exit reasons
40434f5
to
ac8cb63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an perfect in debth review, but I have seen this PR before and it still looks good. Great work again @cdamian!
But would be good to get another pair of eyes on this at least! ^^
This PR will be split into multiple smaller PRs that focus on one part. |
@cdamian do we want to close this? |
@NunoAlexandre Let's keep it open until we merge all remaining parts, it's also helpful for me to keep track of things ^^ |
Sure, I was just trying to follow these gateway-related PRs an given your comments [https://github.com//pull/1376#issuecomment-1635746946] above I thought this PR was now obsolete given those two Parts have been merged already 👍 |
I will document all following PRs here then close it when everything is done. |
Sweet, thanks and sorry for the unintentional noise :) |
Closing this since the last related PR was just merged. Other work related to the topic, such as the precompiles will be done separately and documented accordingly. |
Description
This PR adds the
Connectors Gateway
pallet which will be used to process inbound and outbound Connectors messages.Changes and Descriptions
Connectors Gateway
pallet - entrypoint for Connectors messages that's using theInboundQueue
for processing incoming messages in the case of successful validation, and that implements theOutboundQueue
for processing outgoing messages that are handled by the according XCM or EVM router.Connectors Gateway
pallet which holds the routers that are used in the gateway.Checklist: